<?php 
require_once '../include.php';
 checkLogined();
$rows=getAllConCate();
if(!$rows){
	alertMes("没有相应分类，请先添加分类!!", "addConCate.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>添加资讯</title>

	<link href="http://g.alicdn.com/sj/dpl/1.5.1/css/sui.min.css" rel="stylesheet">
	<script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
	<script type="text/javascript" src="http://g.alicdn.com/sj/dpl/1.5.1/js/sui.min.js"></script>
	<link rel="stylesheet" href="styles/backstage.css">
	<script type="text/javascript">
		function check(){
			
			if(document.getElementById('title').value == ''){
				alert("请输入名称!");
				return false;
			}


			return checkAdmin();
			
			
		}
		function checkAdmin(){
			var url = "doAdminAction.php?act=checkAdmin";  
			var name = document.getElementById('title').value
			var flag = true;
			$.ajax({  
				type: "POST",  
				url: url,  
				async: false,
			// dataType: "json",  
			data: {title:name},  
			success: function(msg){ 
				if(msg){
					alert(msg); 
					flag = false;
				}
			}
		});
			return flag;
		}

	</script>
</head>
<body>
<h3>添加资讯</h3>
<center>
<!-- <form action="doAdminAction.php?act=addCustomer" method="post" onsubmit="return check()"> -->
<form action="doAdminAction.php?act=addConsult" method="post">

<table  cellpadding="5" cellspacing="0"  class="table" >

	<tr>
		<th align="right">资讯分类</th>
		<td>
		<select name="cId" class="bui_select select">
			<?php foreach($rows as $row):?>
				<option value="<?php echo $row['id'];?>"><?php echo $row['cName'];?></option>
			<?php endforeach;?>
		</select>
		</td>
	</tr>
	
	<tr>
		<th align="right" >标题</th>
		<td ><input type="text" id="title" name="title" class="search" placeholder="请输入标题"/></td>
	</tr>
	
	<tr>
		<th align="right" >内容</th>
		<td ><textarea style="background-color: #E8E8E8;width:700px;height:150px;" name="content" id="content" placeholder="请输入内容"></textarea></td>
	</tr>

	<tr>
		<th align="right" >作者</th>
		<td ><input type="text" id="author" name="author" class="search" placeholder="请输入作者名称"/></td>
	</tr>


	<tr>
		<td colspan="2" align="center"><input type="submit" class="btn" value="添加资讯"/></td>
	</tr>

</table>



</form>
</center>
</body>
</html>